package com.example.tvwanandroid.presenter

import com.example.tvwanandroid.base.BaseObserver
import com.example.tvwanandroid.base.BasePresenter
import com.example.tvwanandroid.base.BaseResult
import com.example.tvwanandroid.bean.LoginBean
import com.example.tvwanandroid.view.LoginView

/**
 * @作者: njb
 * @时间: 2020/12/9 10:32
 * @描述:
 */
class LoginPresenter(baseView: LoginView):BasePresenter<LoginView>(baseView) {

    fun getLogin(username:String,password:String){
        addDisposable(apiServer.login(username, password),object :BaseObserver<BaseResult<LoginBean>>(baseView){
            override fun onSuccess(o: BaseResult<LoginBean>) {
                baseView.onLoadLogin(o)
            }

            override fun onError(msg: String?) {
                baseView.showError(msg!!)
            }
        })
    }
}